<template>
	<view class="index">
		<!-- 个人信息 -->
		<view class="mine-main-head">
			<view class="mine-main-head-info">
				<view class="wenzi">
					{{zong}}
				</view>
				<view class="wenzi1">
					平台人数
				</view>
			</view>
		</view>
		<view class="jiange"></view>
		<view class="xiaji" style="color: #555555;">
			募捐明细
			<view class="box"  v-for="(item,index) in boxList" :key="index">
				<view class="shang display_flex flex_between">
					<view class="shangconteny display_flex flex_start">
						<image :src="item.donation_image_url!=''?item.donation_image_url:'/static/img/hader.png'" mode=""></image>
						<text style="position: relative;top: -6upx;">{{item.user_nick_name||'暂无昵称'}}</text>
					</view>
					<view class="jiayi font_size_32" style="color: #FF0F00;font-weight: 600;">
						+{{item.jiequ}}{{item.donation_type}}
					</view>
				</view>
				<!-- FF775F  FF5050 -->
				<view class="xia display_flex flex_between">
					<view class="zongshu font_size_28" >
						{{item.create_time}}
					</view>
					
				</view>
				
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				boxList:[],
				mineData: '',
				page:1,
				zong:'',
				
				
			}
		},
		
		// 离开页面关闭软键盘
		onUnload() {
			// //console.log('离开了当前页面');
			// #ifdef APP-PLUS
			plus.key.hideSoftKeybord();
			// #endif
		},
		onPullDownRefresh() {
			this.donationrecord(1)
		},
		// 上拉加载
		onReachBottom() {
			// //console.log('onReachBottom');
			this.page++;
			this.donationrecord(this.page)
		},
		onLoad(e) {
			this.usercount()
			this.donationrecord(this.page)
		},
		
		methods: {
			// 初始化方法
			async usercount (){
				let data = {}
				const res = await this.$appserve.usercount(data);
				//console.log(res)
				this.zong = res.data.count
				
			},
			jiequ(num, decimal) {
				num = num.toString()
				let index = num.indexOf('.')
				if (index !== -1) {
					num = num.substring(0, decimal + index + 1)
				} else {
					num = num.substring(0)
				}
				return parseFloat(num).toFixed(decimal)
			},
			// 获取记录
			async donationrecord(page) {
				let data = {
					page:page,
					perpage:10,
				}
				const res = await this.$appserve.donationrecord(data);
				let datas = res.data.map((item)=>{
					item.jiequ = this.jiequ(item.donation_value,2) 
					return item
				})
				//console.log(res.data)
				// //console.log(data)
				if (page == 1) {
					this.boxList = datas
				} else {
					this.boxList = this.boxList.concat(datas)
				}
			},
		}
	}
</script>
<style>
	page {
		background-color: #fff !important;
	}
</style>
<style lang="less" scoped>
	.xiaji{
		padding: 30upx;
		
	}
	.zongshu{
		color: #A4A4A4 ;
	}
	.box{
		background: #FFFFFF;
		border-radius: 12px;
		padding: 20upx;
		margin: 0 auto;
		border-bottom: 2upx solid #EDEDED;
	}
	.box view{
		line-height: 60upx;
	}
	.biaoti{
		font-weight: 600;
	}
	.shangconteny{
		line-height: 50upx;
	}
	
	.shangconteny image{
		width: 50upx;
		height: 50upx;
		line-height: 50upx;
		margin-right: 20upx;
		
	}
	.jiayi{
		color: #A4A4A4;
	}
	.mine-main-head-info{
		text-align: center;
		padding-top: 60upx;
	}
	
	.wenzi{
		font-size: 92upx;
		font-family: LiGothicMed;
		color: #FFFFFF;
	}
	.wenzi1{
		font-size: 50upx;
		font-family: LiGothicMed;
		color: #FFFFFF;
	}
	.mine-main-head {
		background: url("") no-repeat;
		width: 100%;
		background-size: 100%;
		height: 400upx;
		padding: 0.1px;
		position: relative;
	}

	
</style>

